<!DOCTYPE html>
<html lang="en">
<head>
  <meta charset="utf-8">
  <title>notice</title>
  <meta name="viewport" content="width=device-width, initial-scale=1, minimum-scale=1, maximum-scale=1">

  <!-- Link Swiper's CSS -->
  <!-- Demo styles -->
  <style>
    html, body {
      position: relative;
      height: 100%;
    }
    body {
      font-family: Helvetica Neue, Helvetica, Arial, sans-serif;
      font-size: 14px;
      /* color:#000; */
      margin: 0;
      padding: 0;
    }
    #contt{
        width: 100vw;
        padding: 0 10px 10px;
        box-sizing: border-box;
    }
    video{
        width: 100% !important;
    }
    img{
        width: 100% !important;
    }
    div,a,p,video,img,span{
        box-sizing: border-box;
    }
  </style>
</head>
<body>
    <div style="padding:10px">
        <span style="font-size:16px;color:#333;font-weight:bold" id="titles"></span>
    </div>
    <div style="padding:0 10px 10px">
        <span style="font-size:14px;color:#999;" id="times"></span>
    </div>
<div id="contt"></div>
  <script>
  setTimeout(e=>{
    getNoticeDetail()
  },200)
  function getNoticeDetail(){
    const token = api.getPrefs({
                sync: true,
                key: 'token1'
            });
    const resu = api.pageParam;
    const res = resu.body;
    const id = res['id'];
    const type = res['type'];
    const url = ["",'/shop-notice/getNotice','/shop-banner/getBanner','/shop-notify/getNotice'];
    api.ajax({
        url:'https://shop.lvlianlegou.com/shop/'+url[type],
        method:"post",
        data:{
            body:{'id':id}
        },
        timeout:10000,
        dataType:"json",
        headers:{
            'Content-Type': 'application/json;charset=utf-8',
            'token':token
        }
}, function(ret, err){
    // console.log(JSON.stringify(ret))

        const times = formatTime(ret.data.gmtCreate);
        document.getElementById("titles").innerText = ret.data.title;
        document.getElementById("times").innerText = times;
        document.getElementById("contt").innerHTML = ret.data.content;
    })
  }
  function getQueryVariable(isEncode) {
  let url = window.location.href;
  　　var obj = {}, reg = /([^?&=]+)=([^?&=]+)/g;
  　　url.replace(reg, function () {
  　　var arg = arguments;
  　　obj[arg[1]] = isEncode ? decodeURIComponent(arg[2]) : arg[2];
  　　});
  　　return obj[isEncode];
}
function formatTime(number,format='Y-M-D h:m:s') {  
            var formateArr  = ['Y','M','D','h','m','s'];  
            var returnArr   = [];  
            
			number = number.indexOf("-")!=-1?number.replace(/\-/g,"/"):number;
            var date = new Date(number);  
            returnArr.push(date.getFullYear());  
            returnArr.push(formatNumber(date.getMonth() + 1));  
            returnArr.push(formatNumber(date.getDate()));  
            
            returnArr.push(formatNumber(date.getHours()));  
            returnArr.push(formatNumber(date.getMinutes()));  
            returnArr.push(formatNumber(date.getSeconds()));  
            
            for (var i in returnArr)  
            {  
            format = format.replace(formateArr[i], returnArr[i]);  
            }  
            return format;  
        }
		  //數据转化  
  function formatNumber(n) {  
    n = n.toString()  
    return n[1] ? n : '0' + n  
  } 
  </script>
</body>
</html>
